AUX_SOURCE_DIRECTORY(.  BASE_SOURCE)

LINK_DIRECTORIES( ${TACRYPTO_LIB_DIR})
LINK_DIRECTORIES( ${OPENSSL_LIB_DIR})
LINK_DIRECTORIES( ${TERMINAL_LIB_DIR})
LINK_DIRECTORIES( ${TERMINAL_LIB_DIR})
AUX_SOURCE_DIRECTORY(src  BASE_SOURCE)

INCLUDE_DIRECTORIES(
	include
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/include
	${CMAKE_CURRENT_LIST_DIR}/terminal-sdk/include
	${CMAKE_CURRENT_LIST_DIR}/fdk-aac/include
	${CMAKE_CURRENT_LIST_DIR}/speex/include
	${CURL_INCLUDE_DIR}
    ${PLATFORM_INCLUDE_DIRS}
	${CORE_SDK_INCLUDE_DIR}
	${OPENSSL_INCLUDE_DIR}
	${HIREDIS_INCLUDE_DIR}
	${JSONCPP_INCLUDE_DIR}
	${REDISCXX_INCLUDE_DIR}
	${APR_INCLUDE_DIR}
	${APR-UTIL_INCLUDE_DIR}/apr-1)

ADD_EXECUTABLE(gbrelaysvr ${BASE_SOURCE})
TARGET_LINK_LIBRARIES(gbrelaysvr 
	${CMAKE_CURRENT_LIST_DIR}/terminal-sdk/lib/libTerminal.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libGbt28181Kit.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libGbtUtil.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libRtpMedia.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libMediaCore.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libGbtComn.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libcomn.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libexosip2.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libosip2.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libjrtp.a
	${CMAKE_CURRENT_LIST_DIR}/gb28181kit/lib/libtinyxml2.a
	${CMAKE_CURRENT_LIST_DIR}/fdk-aac/lib/libfdk-aac.a
	${CMAKE_CURRENT_LIST_DIR}/speex/lib/libspeexdsp.a
	${CORE_SDK_LIBS} ${CURL_LIBS} ${LIBTS_LIBS}  ${OPENSSL_LIBS} ${SENSELOCK_LIBS}  
	${HIREDIS_LIBS} ${JSONCPP_LIBS} ${APR_LIBS} ${REDISCXX_LIBS}  pthread rt dl z)

INSTALL(TARGETS gbrelaysvr DESTINATION bin)


